package net.lastcoder.ifserver.game;

import org.eclipse.jetty.websocket.api.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

/**
 * @author WenYF
 * @email wenyongfu@huohaoyun.cn
 * @since 2021/9/30
 */
public class Client {
    private static final Logger Log = LoggerFactory.getLogger(GameManager.class);

    private Session session;
    private Role role;
    private String userid;

    public Session getSession() {
        return session;
    }

    public void setSession(Session session) {
        this.session = session;
    }

    public Role getRole() {
        return role;
    }

    public void setRole(Role role) {
        this.role = role;
    }

    public String getUserid() {
        return userid;
    }

    public void setUserid(String userid) {
        this.userid = userid;
    }
    
    
    public synchronized void send(String msg) throws IOException {
//        Log.debug("send {} msg: {}", userid, msg);
        session.getRemote().sendString(msg);
        session.getRemote().flush();
    }
    
}
